package com.mdsi.models;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Set;

public class Lesson extends Model {
	
	private Subject subject ;
	public Subject getSubject () { return this.subject ; }
	
	private Calendar startHour ;
	public Calendar getStartHour () { return this.startHour ; }
	public String getReadableStartHour () { return (new SimpleDateFormat("dd/MM/yyyy:hh'h'mm")).format(startHour.getTime()) ; } ;
	
	private Calendar endHour ;
	public Calendar getEndHour () { return this.endHour ; }
	public String getReadableEndHour () { return (new SimpleDateFormat("dd/MM/yyyy:hh'h'mm")).format(endHour.getTime()) ; } ;
	
	private Room room ;
	public Room getRoom () { return this.room ; }
	
	private Teacher teacher ;
	public Teacher getTeacher () { return this.teacher ; }
	
	private Set <Absence> absences ;
	public Set <Absence> getAbsences () { return this.absences ; }
	public void addAbsence (Absence a) {
		this.absences.add(a) ;
	}

	public Lesson(Long id, Subject subject, Room room, Calendar startHour, Calendar endHour, Teacher teacher) {
		super (id) ;
		this.subject = subject ;
		this.room = room ;
		this.startHour = startHour ;
		this.endHour = endHour ;
		this.teacher = teacher ;
		this.absences = new HashSet <Absence> () ;
	}

}
